#include "ThreadPool.hpp"
#include "Thread.hpp"
#include "Tasks.hpp"
#include <iostream>
#include <memory>

void test1()
{

    std::unique_ptr<ThreadPool<CalTask>> tp(new ThreadPool<CalTask>(10));
    tp->run();

    int x, y;
    char op;
    while (true)
    {
        std::cout << "请输入整形数字1# ";
        std::cin >> x;
        std::cout << "请输入整形数字2# ";
        std::cin >> y;
        std::cout << "请输入需要进行的运行 + - * / % # ";
        std::cin >> op;
        CalTask t(x, y, op, my_math);
        std::cout << "你录入了一个任务 " << t.toString() << std::endl;
        tp->push(t);
        sleep(1);
    }
}

int main()
{
    srand((unsigned int)time(0) ^ getpid() ^ pthread_self());
    test1();
    return 0;
}